updated string sizing code and test cases#583
updated string sizing code and test cases#583ArnabChatterjee20k wants to merge 7 commits intoutopia-php:mainfrom
Conversation
WalkthroughThe changes simplify string type handling in the MariaDB adapter by removing intermediate TEXT and MEDIUMTEXT types, using only VARCHAR or LONGTEXT based on the maximum index length. The SQL adapter's Changes
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/Database/Adapter/MariaDB.php(1 hunks)src/Database/Adapter/SQL.php(1 hunks)tests/e2e/Adapter/Scopes/CollectionTests.php(1 hunks)
🔇 Additional comments (2)
src/Database/Adapter/SQL.php (1)
1569-1571: Significant reduction in VARCHAR threshold - verify impact on existing systems.The reduction from 16381 to 767 bytes is a substantial change that simplifies the string type logic as intended. However, this will cause strings that were previously stored as TEXT to now use LONGTEXT, which has different storage characteristics and performance implications.
Consider documenting this breaking change and its potential impact on:
- Storage overhead (LONGTEXT uses more metadata)
- Query performance (LONGTEXT is stored off-page)
- Existing schema migrations
tests/e2e/Adapter/Scopes/CollectionTests.php (1)
522-524: Test expectations correctly updated to reflect new sizing logic.The test updates properly reflect the behavior change where the 'story' attribute (size 20000) now becomes 'longtext' instead of 'text' due to the reduced VARCHAR threshold of 767 bytes. The characterMaximumLength update to '4294967295' is also correct for LONGTEXT.
if ($size > 16777215) {
return 'LONGTEXT';
}
if ($size > 65535) {
return 'MEDIUMTEXT';
}
if ($size > 16381) {
return 'TEXT';
}
return "VARCHAR({$size})";
To
if ($size > 767) {
return 'LONGTEXT';
}
return "VARCHAR({$size})";
Summary by CodeRabbit
Bug Fixes
Tests